using System.Collections.Generic;
using System.Windows;

namespace ChessKit.Common
{
  public class CollectionColorizer : Colorizer<bool>
  {
    public HashSet<BoardLocation> Locations { get; private set; } 

    public void SetLocations(IEnumerable<BoardLocation> src)
    {
      Locations.Clear();
      foreach (var boardLocation in src)
        Locations.Add(boardLocation);
      Refresh();
    }

    public CollectionColorizer(DependencyProperty property) 
      : base(property)
    {
      Locations = new HashSet<BoardLocation>();
    }

    protected override bool TestCore(BoardLocation location)
    {
      return Locations.Contains(location);
    }
  }
}